/* ==================
          加载
 ==================== */

@import "../vars";

.cu-load {
  display: block;
  line-height: 3em;
  text-align: center;
  &::before {
    font-family: "cuIcon";
    display: inline-block;
    margin-right: 6px;
  }
  &.loading {
    &::before {
      content: "\e67a";
      animation: cuIcon-spin 2s infinite linear;
    }
    &::after {
      content: "加载中...";
    }
  }
  &.over {
    &::before {
      content: "\e64a";
    }
    &::after {
      content: "没有更多了";
    }
  }
  &.erro {
    &::before {
      content: "\e658";
    }
    &::after {
      content: "加载失败";
    }
  }
  &.load-icon {
    &::before {
      font-size: 32px;
    }
    &::after {
      display: none;
    }
    &.over {
      display: none;
    }
  }
  &.load-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 140px;
    left: 0;
    margin: auto;
    width: 260px;
    height: 260px;
    background-color: $white;
    border-radius: 10px;
    box-shadow: 0 0 0px 2000px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    font-size: 28px;
    z-index: 9999;
    line-height: 2.4em;
    [class*="cuIcon-"] {
      font-size: 60px;
    }
    image,
    img,
    div[class*="taro-img"] {
      width: 70px;
      height: 70px;
    }
    &::after {
      content: "";
      position: absolute;
      background-color: $white;
      border-radius: 50%;
      width: 200px;
      height: 200px;
      font-size: 10px;
      border-top: 6px solid rgba(0, 0, 0, 0.05);
      border-right: 6px solid rgba(0, 0, 0, 0.05);
      border-bottom: 6px solid rgba(0, 0, 0, 0.05);
      border-left: 6px solid $orange;
      animation: cuIcon-spin 1s infinite linear;
      z-index: -1;
    }
  }
  &.load-image {
    display: flex;
    z-index: 9999;
    justify-content: center;
    align-items: center;
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    image {
      width: 30%;
    }
  }
}

.load-progress {
  pointer-events: none;
  top: 0;
  position: fixed;
  width: 100%;
  left: 0;
  z-index: 2000;
  &.hide {
    display: none;
  }
  .load-progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    overflow: hidden;
    transition: all 200ms ease 0s;
  }
  .load-progress-spinner {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2000;
    display: block;
    &::after {
      content: "";
      display: block;
      width: 24px;
      height: 24px;
      -webkit-box-sizing: border-box;
      box-sizing: border-box;
      border: solid 4px transparent;
      border-top-color: inherit;
      border-left-color: inherit;
      border-radius: 50%;
      -webkit-animation: load-progress-spinner 0.4s linear infinite;
      animation: load-progress-spinner 0.4s linear infinite;
    }
  }
}

@-webkit-keyframes load-progress-spinner {
  0% {
    -webkit-transform: rotate(0);
    transform: rotate(0);
  }

  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

@keyframes load-progress-spinner {
  0% {
    -webkit-transform: rotate(0);
    transform: rotate(0);
  }

  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}
